package msbd;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * Created With IntelliJ IDEA.
 * Descriptions:
 * User:Mr.Du
 * Date:2020/12/2
 * Time:0:34
 */
public class ReversePrint {
    List<Integer> list = new ArrayList<>();
    public int[] reversePrint(ListNode head) {
        List<Integer> l = getInt(head);
        int[] arr = new int[l.size()];

        int j = 0;
        for(int i : l){
            arr[j++] = i;
        }
        return arr;
    }

    public List<Integer> getInt(ListNode head){
        if (head == null) return list;
        getInt(head.next);
        list.add(head.val);
        return list;
    }

    public static void main(String[] args) {
        int[] arr = new int[20];
        int[] brr = new int[20];
        System.out.println(Arrays.equals(arr,brr));
        System.out.println(new String("     2  3 4               ").replaceAll(" ","2"));
    }
    public boolean isUnique(String astr) {
        int[] arr = new int[255];
        for(int i = 0;i<astr.length();i++){
            if(arr[i]!=0) return false;
            arr[astr.charAt(i)-(char)0]++;
        }
        return true;
    }

    public String replaceSpaces(String S, int length) {

        return new String().replaceAll("                          ","2");
    }
}
